package com.bdqn.shiro.service;


import com.bdqn.shiro.config.mybatis.ServiceImpl;
import com.bdqn.shiro.pojo.SysRight;
import com.bdqn.shiro.service.SysRightService;
import com.bdqn.shiro.mapper.SysRightMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 *
 */
@Service
public class SysRightServiceImpl extends ServiceImpl<SysRightMapper, SysRight>
    implements SysRightService{

    @Resource
    private SysRightMapper sysRightMapper;

    /**
     * 根据角色ID查找权限集合
     *
     * @param roleId 角色ID
     * @return
     */
    @Override
    @Cacheable(value = "roleRight", key = "'roleId-' + #roleId", unless = "#result==null")
    public Set<SysRight> findRightByRoleId(Long roleId) {
        return sysRightMapper.findRightByRoleId(roleId);
    }


}




